Skip to content

Conversation

@beldenfox
Copy link
Contributor

@beldenfox beldenfox commented Aug 14, 2025

When changing the width and height of a window the platform code is responsible for enforcing the min and max size constraints. If the final width and height don't match the width and height passed into setBounds the platform needs to call notifyResize to correct the window's properties. This happens naturally if the window size actually changes since that will trigger the OS to send size change notifications. If the platform window size doesn't change the OS notifications won't trigger. We need to catch that case and send notifyResize anyway.

This PR does this for Mac and Windows. Linux is being handled in PR #1789 which also includes the system tests for these bugs.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8364547: Window size may be incorrect when constrained to min or max (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1870/head:pull/1870
$ git checkout pull/1870

Update a local copy of the PR:
$ git checkout pull/1870
$ git pull https://git.openjdk.org/jfx.git pull/1870/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1870

View PR using the GUI difftool:
$ git pr show -t 1870

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1870.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 14, 2025

👋 Welcome back mfox! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 14, 2025

@beldenfox This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8364547: Window size may be incorrect when constrained to min or max

Reviewed-by: kcr, angorya

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 1 new commit pushed to the master branch:

  • 5d06943: 8368478: RichTextArea: add IME support

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Ready for review label Aug 14, 2025
@mlbridge
Copy link

mlbridge bot commented Aug 14, 2025

Webrevs

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable although I haven't tested it. I left one question inline. I presume you have run all systems tests?

Comment on lines 159 to 161
if (minMaxEnforced) {
notifyResize(WindowEvent.RESIZE, pw, ph);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this lead to two resize commands in some cases? I can see why this new logic is needed for the case where the window was already at max (or min) width and height, but if it wasn't already constrained, wouldn't the resize event have already happened?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the Java side updates the property first, and only afterward requests the Glass native side to apply the change. I've found this to cause many problems and I fixed the same way in #1789 - when the change can't be applied, it notifies back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this lead to two resize commands in some cases?

Yes, I was trying not to be too clever with my checks. I figured if the second notification wasn't necessary it would be benign. At the very least it won't trigger invalidation of the window's width and height properties.

I will tighten this up since I have to tweak the code a bit anyway. I just verified that on Windows you can alter the size of a maximized window and the OS will keep it in the MAXIMIZED state (as it resizes glass calls notifyResize with WindowEvent.MAXIMIZED). This PR can kick the window out of the MAXIMIZED or MINIMIZED state incorrectly. Unfortunately it puts the window in the wrong internal state without updating the maximized or iconified properties so it's not easy to write a test to detect this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pending work from you, right? I'll put it back on my review queue once you make the changes you mentioned above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the changes. It should be ready for review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely missed that you had already done this. I'll review it then.

@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Aug 15, 2025

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@kevinrushforth kevinrushforth self-requested a review August 18, 2025 20:29
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 15, 2025

@beldenfox This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@beldenfox
Copy link
Contributor Author

/touch

@openjdk
Copy link

openjdk bot commented Sep 16, 2025

@beldenfox The pull request is being re-evaluated and the inactivity timeout has been reset.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good.

Windows: I ran SizingTest from PR #1789 (removing the assumeTrue that skips the test on Windows), and it fails for me without this fix and passes with this fix.

macOS: I ran SizingTest from PR #1789, and I get 8 test failures without this fix and 4 failures with this fix. The 4 failures are all using StageStyle.EXTENDED, which might be a different bug.

@beldenfox Can you merge in the latest master (I did when testing and there were no issues)? And can you coment on the StageStyle.EXTENDED failures on macOS? I think it would be fine to treat them as a separate bug unless it is easy to fix.

I'll reapprove if you make changes.

@kevinrushforth
Copy link
Member

@lukostyra or @andy-goryachev-oracle Can one of you be the second reviewer?

@beldenfox
Copy link
Contributor Author

Thanks for the review. I'm traveling so won't be able to pick this up again until November.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on macOS 15.7.1 M1
the reproducer works
found no ill effects in the monkey tester.

@openjdk openjdk bot added the ready Ready to be integrated label Oct 28, 2025
@beldenfox
Copy link
Contributor Author

There was a request to merge in the latest master but this PR is also marked as ready. Should I go ahead with the merge?

The SizingTest failures on macOS with StageStyle.EXTENDED are due to some weirdness in the OS. When we set the minimum size on an EXTENDED window the OS simply adds 16 units to the minimum height (I can verify this by writing the minSize and then immediately reading it back). I'm still trying to figure out where this magic number comes from. For EXTENDED we add a toolbar but the minimum size of a toolbar is 28 units. In any case I think this is a separate issue. I'll do a bit more research and file a bug.

@andy-goryachev-oracle
Copy link
Contributor

there are no merge conflicts, you can integrate.

@kevinrushforth
Copy link
Member

A primary reason for merging master in a PR whose source branch is out of date is to catch any problems that might arise due to semantic conflicts. Skara and GitHub do a pretty good job of catching merge conflicts, but there can be semantically conflicting changes even if there are no git merge conflicts.

This is 70 commits behind, so merging master is a good idea. It will trigger a GHA run, which isn't conclusive, but is at least a first pass indicator. If it is a clean merge, there will be no need to re-review.

Having said that, I did my testing using a branch in my repo where I merged in master as of two weeks ago (I always do that when I run CI tests) and didn't see any problems, so if you're confident that there won't be a problem, you can integrate.

@beldenfox
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 31, 2025

Going to push as commit c77c233.
Since your change was applied there has been 1 commit pushed to the master branch:

  • 5d06943: 8368478: RichTextArea: add IME support

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 31, 2025
@openjdk openjdk bot closed this Oct 31, 2025
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Oct 31, 2025
@openjdk
Copy link

openjdk bot commented Oct 31, 2025

@beldenfox Pushed as commit c77c233.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants